﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Cobit5.Web.Cobit
{
    public partial class FrameworkProcess : System.Web.UI.UserControl
    {
        private string _processId;
        public string ProcessId
        {
            get { return _processId; }
            set { _processId = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            List<FrameworkItem> myFrameworkItems=new List<FrameworkItem>();
            myFrameworkItems = (List<FrameworkItem>)HttpContext.Current.Application["FrameworkItems"];

            for (int i = 0; i < myFrameworkItems.Count; i++)
            {
                if (myFrameworkItems[i].ProcessID == this._processId)
                {
                    this.Label_ProcessId.Text = myFrameworkItems[i].ProcessID;
                    //this.Label_ProcessName.Text = myFrameworkItems[i].ProcessName;
                    //this.Label_ProcessName.ToolTip = myFrameworkItems[i].ProcessNameEng;

                    this.HyperLink_ProcessName.Text = myFrameworkItems[i].ProcessName;
                    this.HyperLink_ProcessName.ToolTip = myFrameworkItems[i].ProcessNameEng;
                    this.HyperLink_ProcessName.NavigateUrl = "Process.aspx?id=" + myFrameworkItems[i].ProcessID;

                    this.Label_Process_R.Text = myFrameworkItems[i].PRed.ToString();
                    if (myFrameworkItems[i].PRed < 1)
                        this.Label_Process_R.Visible = false;
                    this.Label_Process_Y.Text = myFrameworkItems[i].PYello.ToString();
                    if (myFrameworkItems[i].PYello < 1)
                        this.Label_Process_Y.Visible = false;
                    this.Label_Process_G.Text = myFrameworkItems[i].PGreen.ToString();
                    if (myFrameworkItems[i].PGreen < 1)
                        this.Label_Process_G.Visible = false;
                    break;
                }
            }
        }
    }
}